package uk.ac.glasgow.demosocs.impl;

import uk.ac.glasgow.demosocs.Candidate;
import java.io.Serializable;
import uk.ac.glasgow.demosocs.users.User;
import uk.ac.glasgow.demosocs.users.UserStoreImpl;

/**
 * Concrete implementation of a candidate
 * @author Team K
 *
 */
public class CandidateImpl implements Candidate, Serializable {       
        private String GUID;
        private String surname;
        private String forename;

        /**
         * Constructor
         * @param guid The candidate's GUID
         */
        public CandidateImpl (String guid) {
                this.GUID = guid;
                UserStoreImpl userStore = new UserStoreImpl("userstore.txt");
                User user = userStore.getUserWithGUID(guid);
                surname = user.getSurname();
                forename = user.getForename();
        }

        /**
         * Getter for GUID
         * @return Candidate's GUID
         */
        public String getGUID() {
                return GUID;
        }
       
        /**
         * Getter for candidate surname
         * @return Candidate's surname
         */
        public String getCandidateSurname() {
                return surname;
        }
       
        /**
         * Getter for candidate forename
         * @return Candidate's forename
         */
        public String getCandidateForename() {
                return forename;
        }
}

